package com.automannn.tomcat.practice.springWeb.webStarter;

import org.springframework.boot.web.servlet.embed_tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.boot.web.servlet.server.WebServer;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

/**
 * @author automannn
 * @time 2021/10/12
 */
public class SpringWebTest {

    public static void main(String[] args) {
        ServletWebServerFactory servletWebServerFactory = new TomcatServletWebServerFactory(8080);
        /*xxx: 设置为 false，则可以近似看成使用spring环境*/
        ((TomcatServletWebServerFactory)servletWebServerFactory).setRegisterDefaultServlet(false);
        /*xxx: 如果设置了集成springSecurity环境，则启动时，会进入springSecurity的运行逻辑 */
        ((TomcatServletWebServerFactory)servletWebServerFactory).setSpringSecurityEnvironment(false);

        /*xxx: 如果设置了集成springSession环境，则启动时，会进入springSession的运行逻辑 */
        ((TomcatServletWebServerFactory)servletWebServerFactory).setSpringSessionEnvironment(false);

        WebServer webServer = servletWebServerFactory.getWebServer();
        webServer.start();


    }
}
